<?php
	session_start();	
?>

<?php
	if( $_SESSION["admin"] != "" )
	{
?>
<a href="index.php?com=country"><b>List country</a></b> | <b><a href="index.php?com=country&func=add">Add new country</b></a>
<br />
<?php 
	include_once("process/country.php");
	$country = new country();
    if( isset($_POST['btnAdd']) )
	{		
		$code = stripcslashes($_POST["country_code"]);
		$name=stripcslashes($_POST["country_name"]);
		$order=stripcslashes($_POST["order"]);
        //echo $code, $name, $order;
        if($code != "" && $name != "")
        {
    		$country->AddCountry($code, $name, $order);	
    	//	echo '<meta http-equiv="Refresh" content="0;URL=index.php?com=country" />';
    		//return;
        }
	}
?>

<form method="post" action="index.php?com=country&func=add" id="contactform" name="addcountry" onSubmit="return validateForm()">
	<table width="70%" style="font-size:10pt;">
		<tr>
			<td align="center" colspan="2" height="50"><b style="font-size:12pt; color:Blue;">Add new country</b></td>
		</tr>
		<tr style="font-weight:bold;">
			<td align="right">Country code :&nbsp;&nbsp;</td>
			<td>
				<input type="text" class="validate[required]" name="country_code" id="country_code" /><font style="color: red;"> *</font>
			</td>
		</tr>
        <tr style="font-weight:bold;">
			<td align="right">Country name :&nbsp;&nbsp;</td>
			<td>
				<input type="text" name="country_name" id="country_name" class="validate[required]" /><font style="color: red;"> *</font>
			</td>
		</tr>
         <tr style="font-weight:bold;">
			<td align="right">Order :&nbsp;&nbsp;</td>
			<td>
				<input type="text" name="order" id="order" /><font style="color: red;"> *</font>
			</td>
		</tr>
		<tr>
			<td></td>
			<td colspan="2" align="left" height="40">
				<input type="submit" name="btnAdd" id="btnAdd" value="Add"  />
				<input type="reset" value="Reset" />
			</td>
		</tr>
	</table>
</form>
<i>Please fill in these fields (<font style="color: red;">*</font>)</i>
<?php
     }
   else
	{
		echo "<meta http-equiv='refresh' content='0; url=login.php' />";
	}
?>